package cn.jhc.util;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HibernateUtil {
	private static SessionFactory sessionFactory;
	static {
		sessionFactory = new Configuration()
				.configure()
				.buildSessionFactory();
	}
	/**
	 * 获取SessionFactory对象
	 * @return
	 */
	public static SessionFactory getSessionFactory(){
		return sessionFactory;
	}
	
	public static Session getSession(){
		return sessionFactory.getCurrentSession();
	}
}
